package sign.dao.mapper;

import org.apache.ibatis.annotations.*;
import sign.dao.entity.*;

import java.util.List;
import java.util.Map;

/**
 * @author GeChen
 * @Description 体征数据的mapper
 * @date 2019/5/8 11:09
 */
public interface SignMapper {

    //通过数据、检测类型以及备注查询对应的体征信息
    InfoPO getInfoPOByData(@Param("data") double data, @Param("type") int type, @Param("remark") String remark);

    //通过用户ID得到最新的血压数据
    CaptureDataPO getLatestBloodPressureByUserId(int userId);

    //通过用户ID得到最新的心电数据
    CaptureDataPO getLatestECGByUserId(int userId);

    //通过用户ID得到最新的温度数据
    CaptureDataPO getLatestTemperatureByUserId(int userId);

    //通过用户ID得到最新的血压数据
    CaptureDataPO getLatestBloodOxygenByUserId(int userId);

    List<ComplexJudgePO> getComplexJudgePOByData(@Param("data") double data, @Param("checkId") int checkId, @Param("remark") String remark);

    JudgeInfoPO getJudgeInfoById(int judgeId);

    //cjn - 通过用户的体征数据查询对应的措施（子查询方式）
    List<String> getNewCaptureInfoByValue(
            double temperature,
            double bloodOxygen,
            double heartRate,
            double diastolicPressure,
            double systolicPressure);

    //获取心肌耗氧量对应的措施
    String getMocMeasure(double mocValue);

    /*
    解耦原来方法，利于复用
     */
    //根据各项体征查询对应的data_id
    List<Integer> getDataIdsByCaptureData(double captureData, int testType, int projectType);

    //根据各项data_id查询measures_info_id
    List<Integer> getMeasuresInfoIdsByDataIds(
            @Param("list1") List<Integer> temperatureId,
            @Param("list2") List<Integer> bloodOxygenId,
            @Param("list3") List<Integer> heartRateId,
            @Param("list4") List<Integer> diastolicPressureId,
            @Param("list5") List<Integer> systolicPressureId);

    //根据measures_info_id查询对应的措施内容
    List<String> getMeasuresByMeasuresInfoIds(List<Integer> measureInfoIds);

    //根据各项体征查询临床诊断id和医学建议id
    List<IntelligentJudgePO> getClinicalJudgeAndMedicalAdvice(
            @Param("list1") List<Integer> temperatureId,
            @Param("list2") List<Integer> heartRateId,
            @Param("list3") List<Integer> respiratoryRateId,
            @Param("list4") List<Integer> bloodPressureId,
            @Param("list5") List<Integer> ambientTemperatureId);

    //查询环境温度id
    List<Integer> getAmbientTemperatureId(double tempval, int testType, int projectType);

    //根据输入的血压值判断所在区间的id
    List<Integer> getBloodPressureId(double sbp, double dbp);

    //根据id查询对应的临床判断
    List<String> getClinicalJudgementById(List<Integer> idList);

    //根据id查询对应的医学建议
    List<String> getMedicalAdviceById(List<Integer> idList);




}
